import { constantRoutes, asyncRoutes } from '@/router'
const state = {
    routes: constantRoutes
}
const mutations = {
    setRoutes(state, newRoutes) {
        console.log(21);
        state.routes = [...constantRoutes, ...newRoutes]
    }
}
const actions = {
    filterRoutes(context, munes) {
        console.log(1);
        const routes = []
        munes.forEach(key => {
            asyncRoutes.some(item => {
                if (item.name === key) {
                    return routes.push(item)
                }
            })
        })
        context.commit('setRoutes', routes)
        return routes
    }
}
export default {
    namespaced: true,
    state,
    mutations,
    actions
}
